package ch2;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AnnotationConfigTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext  = new AnnotationConfigApplicationContext(Ch2BeanConfiguration.class);
        AccountService accountService = applicationContext.getBean("accountService1",AccountService.class);
        System.out.println("before transfer:");
        System.out.println("account 1 balance:"+accountService.getAccount(1).getBalance());
        System.out.println("account 2 balance:"+accountService.getAccount(2).getBalance());
        accountService.transferMoney(1,2,5.0);
        System.out.println("after transfer:");
        System.out.println("account 1 balance:"+accountService.getAccount(1).getBalance());
        System.out.println("account 2 balance:"+accountService.getAccount(2).getBalance());
    }
}
